import Https from '@/utils/https'

// 左侧分组
const queryGetApiGroupReq = (params) => Https.get('/api/v1/myApi/getApiGroup', params)

// 发布
const queryPublishApiByIdReq = (params) => Https.post('/api/v1/myApi/publishApiById', params, {
  needCode: true,
  json: false,
})

// 取消发布
const queryUnPublishApiByIdReq = (params) => Https.post('/api/v1/myApi/unPublishApiById', params, {
  needCode: true,
  json: false,
})

// 查询详情
const queryGetDataApiDetailByIdReq = (params) => Https.get('/api/v1/myApi/getDataApiDetailById', params)

// 删除目录
const queryRemoveDataApiGroupByIdReq = (params) => Https.get('/api/v1/myApi/removeDataApiGroupById', params)

// 新增、更新目录
const querySaveDataApiGroupReq = (params) => Https.post('/api/v1/myApi/saveDataApiGroup', params, { needCode: true })

// 删除api
const queryRemoveDataApiByIdReq = (params) => Https.post('/api/v1/myApi/removeDataApiById', params, {
  needCode: true,
  json: false,
})

// 获取tag 的目录列表
const queryGetApiTagGroupReq = (params) => Https.get('/api/v1/myApi/getApiTag', params)
// 获取当前api 的tag
const queryTheApiTagDetail = (params) => Https.get('/api/v1/myApi/getApiTagById', params, { needCode: true })
// 保存当前api 的最新tags
const saveTheApiTagDetail = (params) => Https.post('/api/v1/myApi/saveApiTagById', params, { needCode: true })
// 新增、更新tag
const querySaveTagApiGroupReq = (params) => Https.post('/api/v1/myApi/saveDataApiTag', params, { needCode: true })
// 删除tag
const queryRemoveApiTagByIdReq = (params) => Https.post('/api/v1/myApi/deleteApiTag', params)

export {
  queryGetApiGroupReq,
  queryPublishApiByIdReq,
  queryUnPublishApiByIdReq,
  queryGetDataApiDetailByIdReq,
  queryRemoveDataApiGroupByIdReq,
  querySaveDataApiGroupReq,
  queryRemoveDataApiByIdReq,
  //  -
  queryGetApiTagGroupReq,
  queryTheApiTagDetail,
  querySaveTagApiGroupReq,
  queryRemoveApiTagByIdReq,
  saveTheApiTagDetail,
}
